<head th:fragment="headerCss">
    <meta charset="utf-8">
    <title>金职母婴官方网站-1+X幼儿照护、产后恢复职业技能等级证书考务平台</title>
    <meta content="width=device-width, initial-scale=1.0" name="viewport">
    <meta name="keywords" content="金职伟业"/>
    <meta name="description"
          content="湖南金职伟业母婴护理有限公司"/>
    <meta name="renderer" content="webkit">
    <link rel="stylesheet" href="/js/layui/css/layui.css">
    <!--<script src="/js/plugins/layer/theme/default/layer.css"></script>-->
    <!-- Bootstrap CSS File -->
    <link href="/lib/bootstrap/css/bootstrap.min.css" rel="stylesheet">
    <!-- Google Fonts -->
    <link href="https://fonts.googleapis.com/css?family=Open+Sans:300,300i,400,400i,700,700i|Raleway:300,400,500,700,800|Montserrat:300,400,700"
          rel="stylesheet">
    <!-- Libraries CSS Files -->
    <link href="/lib/font-awesome/css/font-awesome.min.css" rel="stylesheet">
    <link href="/lib/ionicons/css/ionicons.min.css" rel="stylesheet">
    <link href="/lib/magnific-popup/magnific-popup.css" rel="stylesheet">
    <!-- Main Stylesheet File -->
    <link href="/css/certificateWeb/style.css" rel="stylesheet">
    <link rel="stylesheet" href="/css/selectpage.css" type="text/css">
    <link rel="shortcut icon" href="favicon.ico">
    <script>/*@cc_on document.write('\x3Cscript id="_iealwn_js" src="https://support.dmeng.net/ie-alert-warning/latest.js">\x3C/script>'); @*/</script>
    <style>
        #btnUpload {
            margin-top: 10px;
        }

        .layui-upload-file {
            display: none !important;
            opacity: .01;
            filter: Alpha(opacity=1);
        }

        .bubble {
            position: absolute;
            width: 16px;
            height: 16px;
            text-align: center;
            background-color: #ff5027;
            line-height: 16px;
            color: #ffffff;
            font-size: 12px;
            top: -4px;
            left: 8px;
            margin: 0;
            border-radius: 16px;
            cursor: pointer;
        }



        .image-trigger {
            position: fixed;
            right: 0;
            bottom: 0;
            transform: translateY(-50%);
            cursor: pointer;
        }

        .image-trigger img{
            width: 100px;
        }

        .chat-modal {
            display: none;
            position: fixed;
            top: 12%;
            background: url("../../img/aiBg.png") no-repeat;
            background-size:cover;
            -moz-background-size:cover;
            -webkit-background-size:cover;
            -ms-background-size:cover;
            right: 105px;
            width: 480px;
            border-radius: 8px;
            z-index: 1000;
        }

        .chat-modal.fullscreen {
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            max-width: none;
            border-radius: 0;
            z-index: 21474821001;
        }
        .chat-modal.fullscreen .modal-header{
            padding-bottom: 6px;
        }

        .chat-modal.fullscreen .chat-messages {
            max-height: calc(100vh - 486px);
            height: calc(100vh - 486px);
        }
        .chat-modal.fullscreen .no-problem-css{
            max-height: calc(100vh - 300px);
            height: calc(100vh - 300px);
        }


        .modal-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 16px 16px 26px 16px;
            border-bottom: 0 !important;
        }

        .modal-header h2 {
            margin: 0;
            font-size: 18px;
        }

        .modal-header .close-btn,.modal-header .fullscreen-btn{
            width: 16px;
            height: 16px;
            cursor: pointer;
        }

        .chat-messages {
            padding: 16px;
            max-height: 376px;
            overflow-y: auto;
            height: 276px;
            flex: 1;
            padding-bottom: 43px;
        }

        .message {
            padding: 10px 15px;
            border-radius: 8px;
            max-width: 70%;
            color: #333;
            display: inline-block;
        }
        .message-box{
            text-align: right;
            padding: 10px 15px;
            margin-bottom: 24px;
        }
        .user-message {
            background-color: #FFD0D1;
            margin-left: auto;
            text-align: left;
            font-size: 15px;
            word-wrap: break-word;
        }

        .ai-message {
            color: #555;
            width: 100%;
            max-width: 100%;
            font-size: 14px;
            padding-bottom: 0;
            /*background-color: #f1f5f9;*/
        }
        .main-text{
            color: #333;
            font-size: 16px;
        }

        .chat-input {
            padding: 16px;
            position: absolute;
            width: 100%;
            bottom: 0;
        }

        .chat-input textarea {
            padding: 16px;
            height: 120px;
            background: #FFFFFF;
            width: 100%;
            border-radius: 8px;
            resize: none;
            user-select: none;
            -webkit-user-drag: none;
            border: 1px solid #DC000C;
            position: relative;
        }
        .chat-input .send-button,.stop-button{
            position: absolute;
            right: 32px;
            bottom: 32px;
            width: 32px;
            height: 32px;
            cursor: pointer;
        }

        .overlay {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background-color: rgba(0, 0, 0, 0.5);
            z-index: 999;
        }
        /*滚动条设置，仅对chrome生效*/
        /*定义滚动条高宽及背景 高宽分别对应横竖滚动条的尺寸*/
        ::-webkit-scrollbar {
            /*滚动条整体样式*/
            width: 6px;
            /*高宽分别对应横竖滚动条的尺寸*/
            height: 6px;
            background: #f5f5f5;
        }

        /*定义滑块 内阴影+圆角*/
        ::-webkit-scrollbar-thumb {
            border-radius: 6px;
            background: #ccc;
        }

        /*定义滚动条轨道 内阴影+圆角*/
        ::-webkit-scrollbar-track {
            border-radius: 6px;
            background: #f5f5f5;
        }

        /* 现代浏览器 (WebKit/Blink 内核，如 Chrome, Safari, Edge) */
        .custom-scrollbar::-webkit-scrollbar {
            width: 6px; /* 纵向滚动条宽度 */
            height: 6px; /* 横向滚动条高度 */
        }

        .custom-scrollbar::-webkit-scrollbar-track {
            background: #f1f1f1; /* 滚动条轨道背景色 */
            border-radius: 4px;
        }

        .custom-scrollbar::-webkit-scrollbar-thumb {
            background: #c1c1c1; /* 滚动条滑块颜色 */
            border-radius: 4px;
        }

        .custom-scrollbar::-webkit-scrollbar-thumb:hover {
            background: #a8a8a8; /* 鼠标悬停时滑块颜色 */
        }

        /* Firefox */
        .custom-scrollbar {
            scrollbar-width: thin; /* 滚动条宽度：auto(默认) | thin | none */
            scrollbar-color: #c1c1c1 #f1f1f1; /* 滑块颜色 轨道颜色 */
        }

        /* Internet Explorer 10+ */
        .custom-scrollbar {
            -ms-overflow-style: -ms-autohiding-scrollbar; /* 自动隐藏滚动条 */
        }
        .des-box{
            padding: 14px 16px 0 16px;
        }
        .des-box .ai-introduce{
            height: 116px;
            background: linear-gradient( 180deg, #FFE9E9 0%, #FFFFFF 34%);
            box-shadow: 0px 4px 16px 0px rgba(88,0,0,0.08);
            border-radius: 16px 16px 16px 16px;
            padding: 16px 24px 16px 0;
            border: 1px solid #FFFFFF;
            position: relative;
        }
        .des-box .ai-introduce img{
            position: absolute;
            left: -15px;
            top: -18px;
            width: 127px;
            height: 132px;
        }
        .des-box .ai-introduce .des-text{
            padding-left: 149px;
        }
        .des-box .ai-introduce .title-text{
            font-size: 20px;
            color: #09153D;
            line-height: 28px;
            padding-bottom: 8px;
        }
        .des-box .ai-introduce .introduce-text{
            font-size: 14px;
            color: #09153D;
            line-height: 24px;
        }
        .chat-input img.send-button {
            cursor: not-allowed;
            opacity: 0.5; /* 新增：设置初始透明度为 0.5，使按钮变灰 */
            /*pointer-events: none;*/
        }

        .chat-input img.send-button.active {
            opacity: 1; /* 新增：激活状态下透明度为 1，使按钮高亮 */
            cursor:pointer;
            /*pointer-events: auto; */
        }
        .qusetion-box{
            padding: 0 16px 0 16px;

        }
        .qusetion-box .item{
            cursor: pointer;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            font-size: 13px;
            background: #fff;
            padding: 8px 16px;
            color: #09153D;
            margin-top: 12px;
            border-radius: 8px;
            border: 1px solid #efefef;
        }
        .mask{
            position: fixed;
            width: 100%;
            height: 100%;
            background: transparent;
            left: 0;
            top: 0;
            z-index: 666;
        }
        /* 防止空段落占用高度 */
        .ai-message div:empty {
            display: none;
        }

        /* 段落间距通过 CSS 控制而非 <br> */
        .ai-message div {
            margin-bottom: 12px;
            line-height: 1.6;
        }
        /* Markdown 样式 */
        .ai-message h1, .ai-message h2, .ai-message h3, .ai-message h4, .ai-message h5, .ai-message h6 {
            color: #333;
            margin-top: 24px;
            margin-bottom: 8px;
            font-size: 14px;
        }

        .ai-message p {
            margin-bottom: 16px;
        }

        /* 列表样式 (新增) */
        .ai-message ul, .ai-message ol {
            margin-left: 0;
            margin-bottom: 16px;
            padding-left: 24px;
        }

        .ai-message ul {
            list-style-type: disc;
        }

        .ai-message ol {
            list-style-type: decimal;
        }

        .ai-message li {
            margin-bottom: 8px;
            position: relative;
        }

        .ai-message ol li, .ai-message ul li {
            list-style: disc;
        }

        /* 表格样式 */
        .ai-message table {
            width: 100%;
            margin-bottom: 16px;
            border-collapse: collapse;
            border-spacing: 0;
            overflow-x: auto;
            display: block;
        }

        .ai-message th, .ai-message td {
            padding: 10px 12px;
            border: 1px solid #e0e0e0;
            text-align: left;
        }

        .ai-message th {
            background-color: #f5f5f5;
            font-weight: 600;
            color: #333;
        }

        .ai-message tr:nth-child(even) {
            background-color: #f9f9f9;
        }

        .ai-message tr:hover {
            background-color: #f0f0f0;
            transition: background-color 0.2s ease;
        }

        /* 在小屏幕上允许表格横向滚动 */
        @media (max-width: 600px) {
            .ai-message table {
                display: block;
                width: 100%;
                overflow-x: auto;
            }
        }

        .ai-message pre {
            background-color: #f5f5f5;
            padding: 16px;
            border-radius: 4px;
            overflow-x: auto;
            margin-bottom: 16px;
        }

        .ai-message code {
            font-family: Consolas, Monaco, 'Andale Mono', monospace;
            font-size: 13px;
            background-color: #f0f0f0;
            padding: 3px 6px;
            border-radius: 3px;
        }

        .ai-message pre code {
            background-color: transparent;
            padding: 0;
        }

        .ai-message blockquote {
            border-left: 4px solid #ddd;
            padding-left: 16px;
            margin-left: 0;
            color: #666;
            margin-bottom: 16px;
        }

        .ai-message a {
            color: #007bff;
            text-decoration: none;
        }

        .ai-message a:hover {
            text-decoration: underline;
        }

        .ai-message img {
            max-width: 100%;
            height: auto;
            margin: 16px 0;
            border-radius: 4px;
        }

        /* 加载动画 */
        .typing-animation {
            display: inline-block;
            width: 18px;
            height: 18px;
            position: relative;
        }

        .typing-animation span {
            display: block;
            width: 4px;
            height: 4px;
            background-color: #666;
            border-radius: 50%;
            position: absolute;
            animation: typing 1.4s infinite ease-in-out both;
        }

        .typing-animation span:nth-child(1) {
            left: 0px;
            animation-delay: 0s;
        }

        .typing-animation span:nth-child(2) {
            left: 7px;
            animation-delay: 0.2s;
        }

        .typing-animation span:nth-child(3) {
            left: 14px;
            animation-delay: 0.4s;
        }

        @keyframes typing {
            0%, 80%, 100% { transform: scale(0); }
            40% { transform: scale(1); }
        }
        /* 自定义loading样式 */
        .typing-loader {
            display: inline-block;
            margin-left: 15px;
            width: 16px;
            height: 16px;
            border: 2px solid #f3f3f3;
            border-radius: 50%;
            border-top: 2px solid #DC000C;
            animation: spin 1s linear infinite;
            vertical-align: middle;
        }

        @keyframes spin {
            0% { transform: rotate(0deg); }
            100% { transform: rotate(360deg); }
        }
        .message-buttons {
            display: flex;
            gap: 8px;
            padding-left: 15px;
        }

        .message-buttons button {
            padding: 4px 8px;
            background-color: #f0f0f0;
            border: none;
            border-radius: 4px;
            cursor: pointer;
            font-size: 12px;
        }
        .regenerate-btn{
            width: 20px;
            height: 20px;
            background: url("../../img/regenerate.png") no-repeat;
            background-size: 20px 20px;
            -moz-background-size: 20px 20px;
            -webkit-background-size: 20px 20px;
            cursor: pointer;
        }
        .copy-btn{
            width: 20px;
            height: 20px;
            background: url("../../img/copytext.png") no-repeat;
            background-size: 20px 20px;
            -moz-background-size: 20px 20px;
            -webkit-background-size: 20px 20px;
            cursor: pointer;
            margin-left: 6px;
        }
        .copy-text img{
            width: 20px;
            height: 20px;
            background: url("../../img/copytext.png") no-repeat;
            background-size: 20px 20px;
            -moz-background-size: 20px 20px;
            -webkit-background-size: 20px 20px;
            cursor: pointer;
            margin-left: 6px;
        }

        .message-buttons button:hover {
            background-color: #e0e0e0;
        }
        .use-buttons{
            text-align: right;
            font-size: 14px;
            color: #aaa;
            cursor: pointer;
        }
       /* 添加最小高度防止内容抖动 */
       /* .ai-message {*/
       /*     min-height: 1.2em;*/
       /*     white-space: pre-wrap;*/
       /* }*/

        /* 优化滚动容器 */
        #chat-messages {
            scroll-behavior: smooth;
            overflow-anchor: none;
        }

        /*!* 保持最后消息的定位 *!*/
        /*.message-box:last-child {*/
        /*    overflow-anchor: auto;*/
        /*}*/
    </style>
</head>
<div th:fragment="header">
    <div class="header" id="header">
        <div class="header-block flex-row">
            <a href="/certificate/homepage" class="img-block logo"><img src="/img/jzwy.png?r=1212" alt="logo"
                                                                        style="float:left;width:200px;"></a>
            <div class="header-r flex-row" style="float:right;">
                <div class="logReg">
                    <div class="item no" style="display: inline;font-size: 14px">
                        <a href="/certificate/loginWeb" class="item-a">登录</a> |
                    </div>
                    <div class="item no" style="display: inline;font-size: 14px">
                        <a href="/certificate/registerWeb" class="item-a">注册</a>
                    </div>
                    <div class="item yes" style="display: none;font-size: 14px">
                        <a href="/certificate/my" id="my" class="item-a" style="padding: 2px 4px;">
                            [&nbsp;<span id="user" style="color:#ff751a;font-weight:bold" th:text="${uName}"></span>&nbsp;]&nbsp;个人中心</a>
                        <i class="fa fa-bell-o" aria-hidden="true" id="msgSize"
                           style="position: relative;font-size: 16px;cursor: pointer">
                            <span class="bubble" style="display: none"></span>
                        </i>
                    </div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                    <div class="yes" style="display: none;font-size: 14px">
                        <a href="#" id="loginOut" style="width: 100px">安全退出</a>
                    </div>
                </div>
                <div class="main-nav flex-row">
                    <div class="item"><a href="/certificate/homepage" class="item-a">首页</a></div>
                    <div class="item"><a href="/certificate/standardInfo" class="item-a">职业技能证书</a></div>
                    <div class="item"><a href="/certificate/policyInfo" class="item-a">信息资讯</a></div>
                    <!--<div class="item"> <a href="/certificate/testingCentreQuery" class="item-a" target="_blank">信息查询</a> </div>-->
                    <div class="item" id="apply"><a href="/certificate/testingCentreApplyFor?type=5&profileName=幼儿照护职业技能等级证书" class="item-a">站点申请</a>
                    </div>
                    <div class="item" id="apply1"><a href="/certificate/evaluationStationApplyFor?type=4" class="item-a">专家申请</a></div>
                    <div class="item"><a href="/certificate/dataDownload/skillLeve" class="item-a">资料下载</a></div>
                    <div class="item"><a href="/certificate/certificateWeb" class="item-a">关于我们</a></div>
                    <!--<div class="item"> <a href="#" class="item-a">综合管理平台</a> </div>-->
                </div>
            </div>
            <div style="clear: both"></div>
        </div>
    </div>
    <div style="height:69px"></div>
</div>


<div th:fragment="footer">
    <div class="image-trigger">
        <img src="../../img/aiFloat1.png"  alt="金智云AI助理">
        <div class="bg-color">
        </div>
    </div>
    <div class="chat-modal">
        <div class="modal-header">
            <h2>金智云AI助理</h2>
            <div>
                <img style="margin-right: 24px" class="fullscreen-btn" src="../../img/aiReduce.png">
                <img class="close-btn" src="../../img/aiClose.png">
            </div>
        </div>
        <div class="des-box">
            <div class="ai-introduce">
                <div class="des-text">
                    <div class="title-text">Hi~  我是金智云Ai</div>
                    <div class="introduce-text">欢迎使用金智云AI，遇到问题跟我说，为您提供支持。</div>
                </div>
                <img src="../../img/aiPicture.png">
            </div>
        </div>
        <div class="qusetion-box" id="question-box"></div>
        <div class="chat-messages" id="chat-messages"></div>
        <div style="height: 120px"></div>
        <div class="chat-input">
            <textarea  id="user-input" placeholder="请在此处输入您的提问~"></textarea>
            <img class="send-button"  id="send-button" src="../../img/aiSend.png">
            <img class="stop-button"  id="stop-button" src="../../img/aiStop.png" style="display: none;">
        </div>
    </div>
    <div class="mask" style="display: none;"></div>
    <footer id="footer" style="max-width:1920px">
        <div class="container" style="width: 1200px;margin: auto;display: flex">

            <div class="copyright">
                <div>公司地址：湖南省长沙市雨花区香樟路255号云集大厦四楼</div>
                <div>联系电话：400-8718-776&nbsp;/&nbsp;17680168473</div>
                <a target="_blank" href="http://www.jzwy123.com/">版权所有：湖南金职伟业母婴护理有限公司</a><br>
                <a target="_blank" href="">技术支持：长沙民振教育科技有限公司</a><br>
                <a href="http://beian.miit.gov.cn" target="_blank">备案号：湘ICP备20003916号</a>
            </div>
            <!-- <div class="footer_box"> -->
                <!-- <div class="footer_txt">
                    <i class="iconfont icon-telephone2" aria-hidden="true" style="color:#e70012;font-size: 20px;"></i>
                    <span>咨询电话</span>
                    <p style="color: #e70012;font-weight: 800;
                    font-size: 16px;">400-8718-776</p>
                    <p>我院实施<span>质量、环境、职业健康安全管理体系</span>，即三标一体化管理体系，以<span>质量</span>求生存，以<span>创新</span>谋发展，以<span>服务</span>赢信誉，以<span>品牌</span>占市场</p>
                </div>
                <div class="footer_us">
                    <span>关于我们</span>
                    <p>企业简介</p>
                    <p>领导团队</p>
                    <p>组织机构</p>
                    <p>经营范围</p>
                    <p>荣誉质量</p>
                    <p>服务宗旨</p>
                </div>
                <div class="footer_us">
                    <span>项目业绩</span>
                    <p>获奖项目</p>
                    <p>环境卫生</p>
                    <p>风景园林</p>
                    <p>城乡规划</p>
                    <p>建筑计划</p>
                </div>
                <div class="footer_us">
                    <span>新闻中心</span>
                    <p>企业新闻</p>
                    <p>企业专题</p>
                    <p>建党工作</p>
                </div>
                <div class="footer_us">
                    <span>关注我们</span>
                    <p>微信</p>
                    <p>微博</p>
                    <p>在线客服</p>
                </div> -->
                <div class="footer_img">
                    <img src="../../img/QRcode.jpg" alt="">
                    <img src="../../img/QRcode1.jpg" alt="">
                </div>
            </div>

            <!-- <div class="footer_hd">
                <p>马可波罗 Onlylady 女人志 艺龙旅游指南 欣欣旅游网 户外运动 365香乐网 爱问共享资料 旅游网小说网 学习啦游多多 自助游教育 火车时刻表 驴妈妈旅游网 好豆美食网 二手车绿野户外 途牛旅游网
                    图吧 SUV联合越野 手机浏览器 上海地图 天气预报 携程旅游 锦江旅游 火车时刻表 TripAdvisor 天巡网 自在客租租车 五分旅游网 酒店预订 爱旅行网 旅游旅游网 wed114 结婚
                    网 车讯网 邀游旅游网 手机 更多友情链接 >></p>
            </div> -->

            <!-- <div class="credits">
            </div> -->

    </footer><!-- #footer -->
    <!-- <div class="footer_end">
        <div style="padding-top: 15px;">
            <span>&copy;</span>2012-2017 www.cucd.cn 京1CP备11015476号 京公网安备 110105013401 号 京1CP证 110318 号
           <p> 营业执照 新出网证(京)字242 号 全国统一客服电话:010-57365736 网站地图</p>
        </div>

    </div> -->
    <script src="/lib/jquery/jquery.min.js"></script>


    <script src="/lib/ai/markdown-it.min.js"></script>


    <script src="/lib/jquery/jquery-migrate.min.js"></script>
    <script src="/js/layui/layui.js"></script>
    <script src="/js/plugins/layer/layer.min.js"></script>
    <script src="/js/plugins/validate/jquery.validate.min.js"></script>

    <script src="/js/plugins/validate/messages_zh.min.js"></script>

    <script src="/lib/bootstrap/js/bootstrap.bundle.min.js"></script>
    <!--多级导航栏插件-->
    <script src="/lib/superfish/hoverIntent.js"></script>
    <script src="/lib/superfish/superfish.min.js"></script>
    <!--响应式弹出层和对话框插插件-->
    <script src="/lib/magnific-popup/magnific-popup.min.js"></script>
    <script src="/js/certificateWeb/main.js"></script>

    <!--分页下拉框-->
    <script type="text/javascript" src="/js/selectpage.js"></script>
    <script>
        window.onscroll = function () {
            if (document.documentElement.scrollLeft != 0) {
                var sl = -Math.max(document.body.scrollLeft + 100, document.documentElement.scrollLeft + 100);
                document.getElementById('header').style.left = sl + 'px';
            } else {
                document.getElementById('header').style.left = '0px';
            }
        };
        $(function () {
            var userName = window.localStorage.getItem("userName");
            var unreadNum = window.localStorage.getItem("unreadNum0");
            if (userName != "" && userName != null) {
                $("#user").text(userName);
                $('.yes').css("display", "inline");
                $('.no').css("display", "none");
                if (unreadNum != 0 && unreadNum != null && unreadNum != '') {
                    $(".bubble").css("display", "inline");
                    $(".bubble").html(unreadNum)
                }
            } else {
                $(".yes").css("display", "none");
                $(".no").css("display", "inline")
            }
            $("#loginOut").click(function () {
                localStorage.clear();
                location.href = '/certificate/homepage';
            })
        });
        //公用导航栏的根据url控制选中导航
        $(function () {
            var links = $(".item").find("a");
            index = 0,//默认第一个菜单项
                url = location.href.split('?')[0].split('/').pop();//取当前URL最后一个 / 后面的文件名，pop方法是删除最后一个元素并返回最后一个元素
            // console.log("url",url)
            if (url) {//如果有取到, 则进行匹配, 否则默认为首页(即index的值所指向的那个)
                for (var i = 0; i < links.length; i++) {//遍历 menu 的中连接地址
                    if(url=='skillLeve'||url=='teaching'||url=='scoreCriteria'||url=='evaluationCriteria'||url=='courseCriteria'||url=='operationManual'||url=='otherData'){
                	    url='skillLeve';
                    }
                    if (links[i].href.indexOf(url) !== -1) {  //有
                        index = i;
                        break;
                    }
                }
            }
            if (url == 'homepage' || url == 'standardInfo' || url == 'policyInfo' || url == 'skillLeve' ||
                url == 'certificateWeb' ||url == 'dataDownload'||url == 'testingCentreApplyFor' || url == 'evaluationStationApplyFor' || url == 'my') {
                links[index].className += ' cur';
            }
            $("#msgSize").click(function () {
                location.href = '/certificate/message';
            })
        });
    </script>

    <script>
        $(document).ready(function () {
            $('.chat-modal').on('mouseover', '.copy-btn', function() {
                layer.tips('复制', this, {
                    tips: 1,
                    tipsMore: false, // 仅显示一次，若需要每次都显示则设为true
                    time: 0 // 不自动关闭，鼠标移出后消失
                });
            }).on('mouseleave', '.copy-btn', function() {
                layer.closeAll('tips'); // 鼠标移出时关闭提示
            });

            $('.chat-modal').on('mouseover', '.copy-text', function() {
                layer.tips('复制', this, {
                    tips: 1,
                    tipsMore: false, // 仅显示一次，若需要每次都显示则设为true
                    time: 0 // 不自动关闭，鼠标移出后消失
                });
            }).on('mouseleave', '.copy-text', function() {
                layer.closeAll('tips'); // 鼠标移出时关闭提示
            });

            $('.chat-modal').on('mouseover', '.regenerate-btn', function() {
                layer.tips('重新生成', this, {
                    tips: 1,
                    tipsMore: false, // 仅显示一次，若需要每次都显示则设为true
                    time: 0 // 不自动关闭，鼠标移出后消失
                });
            }).on('mouseleave', '.regenerate-btn', function() {
                layer.closeAll('tips'); // 鼠标移出时关闭提示
            });

            // 配置 markdown-it 解析器（仅核心功能）
            const mymarkdown = window.markdownit({
                html: true,
                linkify: true,
                typographer: true,
                breaks: true
            });
            // 初始化发送按钮状态
            updateSendButtonState();

            // 监听 textarea 输入事件
            $('#user-input').on('input', function () {
                updateSendButtonState();
            });
            const token = localStorage.getItem('token'); // 从浏览器中获取 token
            let getToken = ''
            let domainName = 'https://aiapi.jz1x.com'
            // 获取问题列表
            $.ajax({
                url: domainName+'/ai_service/df/chat/getProblem',
                type: 'POST',
                contentType: 'application/json',
                success: function (response) {
                    if(response.code==200){
                        let getData = response.data&&response.data.listProblem&&response.data.listProblem.slice(0,3)
                        getToken = response.data&&response.data.token
                        console.log('response问题',response.data.listProblem)
                        if(getData&&getData.length>0){
                            const questionBox = $('#question-box');
                            getData.forEach(function (question) {
                                questionBox.append(`<div class="item">${question}</div>`);
                            });
                        }else{
                            $('#chat-messages').addClass('no-problem-css')
                        }
                    }
                },
                error: function (jqXHR, textStatus, errorThrown) {
                    console.error('获取问题列表失败:', textStatus, errorThrown);
                }
            });

            $('.image-trigger').click(function () {
                $('.chat-modal').fadeIn();
                $('.mask').fadeIn();
            });

            $('.close-btn').click(function () {
                $('.chat-modal').fadeOut();
                $('.mask').fadeOut();
            });

            $('.fullscreen-btn').click(function () {
                if ($('.chat-modal').hasClass('fullscreen')) {
                    $('.chat-modal').removeClass('fullscreen');
                } else {
                    $('.chat-modal').addClass('fullscreen');
                }
            });

            let currentRequest = {
                taskId: null,
                isActive: false,
                isStreaming: false,
                currentUserMessage: null,
                currentAiMessage: null
            };
            let woyaohuode = null

            function resetRequestState() {
                currentRequest = {
                    taskId: null,
                    isActive: false,
                    isStreaming: false,
                    currentUserMessage: null,
                    currentAiMessage: null
                };
            }

            // 函数：为用户消息添加复制按钮
            function addCopyButtonToUserMessage(messageBox) {
                const buttonsContainer = $('<div class="use-buttons"></div>');
                const copyBtn = $('<span class="copy-text"><img src="../../img/copytext.png"/></span>');

                buttonsContainer.append(copyBtn);
                messageBox.append(buttonsContainer);

                copyBtn.click(function() {
                    const messageText = messageBox.find('.user-message').text();
                    const tempTextArea = $('<textarea>');
                    tempTextArea.val(messageText).appendTo('body').select();
                    document.execCommand('copy');
                    tempTextArea.remove();

                    const originalText = copyBtn.text();
                    //copyBtn.text('复制成功');
                    layer.msg('复制成功！');
                });
            }

            let controller = new AbortController(); //AbortController 实例对象 controller

            // 在顶部定义打字机相关变量
            let typingQueue = [];      // 待显示的字符队列
            let displayedAnswer = "";  // 已显示的内容
            let isTyping = false;      // 是否正在输入中
            let  allCopy=""
            let  allCopyMymarkdown =""


            $('#send-button').click(function () {
                if (currentRequest.isActive) return;
                allCopy = ""
                resetRequestState();
                currentRequest.isActive = true;
                currentRequest.isStreaming = true;

                const userInput = $('#user-input').val();
                if (userInput.trim() === ''){
                    currentRequest.isActive = false;
                    currentRequest.isStreaming = false;
                    return;
                };

                $('#send-button').hide();
                $('#stop-button').show();

                // 保存当前用户消息的引用
                const userMessage = $(`<div class="message user-message">${userInput}</div>`);
                const userMessageBox = $(`<div class="message-box user-message-box"></div>`);
                userMessageBox.append(userMessage);
                $('#chat-messages').append(userMessageBox);
                currentRequest.currentUserMessage = userMessage;

                // 在用户消息后添加复制按钮
                addCopyButtonToUserMessage(userMessageBox);

                $('#user-input').val('');
                $('#chat-messages').animate({ scrollTop: $('#chat-messages')[0].scrollHeight }, 0);

                updateSendButtonState();

                const loadingMessage = $('<div class="message ai-message loading">正在思考中...</div>');
                $('#chat-messages').append(loadingMessage);
                $('#chat-messages').animate({ scrollTop: $('#chat-messages')[0].scrollHeight }, 0);

                const url = domainName + '/ai_service/df/chat/dialogue';
                const data = { content: userInput.trim(), token: token ? token : getToken };


                fetch(url, {
                    method: 'POST',
                    headers: { 'Content-Type': 'application/json' },
                    body: JSON.stringify(data),
                    signal: controller.signal
                })
                    .then(response => {
                        if (!response.ok) {
                            loadingMessage.remove();
                            const errorMessage = $('<div class="message ai-message">网络响应状态不佳!</div>');
                            $('#chat-messages').append(errorMessage);
                            addButtonsToMessage(errorMessage);
                            currentRequest.isStreaming = false;
                            showButtons();
                            currentRequest.isActive = false;
                            return null;
                        }
                        return response.body.getReader();
                    })
                    .then(reader => {

                        // 清空打字机相关状态
                        typingQueue = [];
                        displayedAnswer = "";
                        isTyping = false;

                        const aiMessage = $('<div class="message ai-message"></div>');
                        // 创建加载动画元素
                        const typingLoader = $('<div class="typing-loader"></div>');
                        $('#chat-messages').append(aiMessage);
                        $('#chat-messages').append(typingLoader);
                        // 保存当前AI消息的引用
                        currentRequest.currentAiMessage = aiMessage;
                        woyaohuode = aiMessage
                        let fullAnswer = '';
                        let thinkEndFound = false;
                        function readStream() {
                            return reader.read().then(({ done, value }) => {
                                if (done) {
                                    // 新增：等待队列处理完成
                                    const checkQueue = setInterval(() => {
                                        if (typingQueue.length === 0 && !isTyping) {
                                            clearInterval(checkQueue);
                                            // 延迟确保最后字符渲染完成
                                            setTimeout(() => {
                                                loadingMessage.remove();
                                                typingLoader.fadeOut(300, function() {
                                                    $(this).remove();
                                                    addButtonsToMessage(aiMessage);
                                                });
                                                currentRequest.isStreaming = false;
                                                showButtons();
                                                finishRequest();
                                            }, 100);
                                        }
                                    }, 50);
                                    return;
                                }

                                const chunk = new TextDecoder().decode(value);
                                const lines = chunk.split('\n');

                                lines.forEach(line => {
                                    if (line.startsWith('data:')) {
                                        const data = line.slice(5).trim();
                                        try {
                                            loadingMessage.remove();
                                            const parsedData = JSON.parse(data);
                                            const newContent  = parsedData.answer ? parsedData.answer.replace(/<think>/g, '') : '';
                                            // 将新内容加入队列（关键修改）
                                            typingQueue.push(...newContent.split(''));

                                            allCopy += parsedData.answer
                                            allCopyMymarkdown = mymarkdown.render(allCopy);
                                            // 启动打字机效果
                                            if (!isTyping) {
                                                typeCharacter();
                                            }

                                            if (parsedData.task_id) {
                                                currentRequest.taskId = parsedData.task_id;
                                            }

                                            // // 修改：使用 markdown-it 解析 Markdown
                                            // const html = mymarkdown.render(fullAnswer);
                                            // aiMessage.html(html);


                                            $('#chat-messages').animate({ scrollTop: $('#chat-messages')[0].scrollHeight }, 0);
                                        } catch (error) {}
                                    }
                                });
                                return readStream();
                            });
                        }

                        // 新增打字机效果函数
                        // 修改typeCharacter函数
                        function typeCharacter() {
                            if (!currentRequest.isStreaming || typingQueue.length === 0) {
                                isTyping = false;
                                return;
                            }

                            isTyping = true;

                            // 批量处理字符（优化性能）
                            const batchSize = Math.min(typingQueue.length, 3); // 每次处理3个字符
                            let processed = '';

                            for (let i = 0; i < batchSize; i++) {
                                processed += typingQueue.shift();
                            }

                            displayedAnswer += processed;

                            // 使用requestAnimationFrame优化渲染
                            requestAnimationFrame(() => {
                                const html = mymarkdown.render(displayedAnswer);
                                aiMessage.html(html);

                                $('#chat-messages').animate({ scrollTop: $('#chat-messages')[0].scrollHeight }, 0);
                            });

                            // 调整打字间隔
                            setTimeout(typeCharacter, 50); // 动态速度
                           // setTimeout(typeCharacter, Math.max(20, 60 - batchSize * 10))// 动态速度
                        }

                        function finishRequest() {
                            $('#send-button').show();
                            $('#stop-button').hide();
                            currentRequest.isActive = false;
                            resetRequestState();
                        }

                        return readStream();
                    })
                    .catch(error => {
                        console.log('woyaohuode',woyaohuode)
                        if(error.name === "AbortError") {
                            let biandf = woyaohuode
                             console.log('biandf',biandf)
                            const buttonsContainer = $('<div class="message-buttons"></div>');
                            const regenerateBtn = $('<span class="regenerate-btn"></span>');
                            const copyBtn = $('<span class="copy-btn"></span>');
                            // 创建隐藏的hahsdk元素并添加到按钮容器
                            const hashsdkElement = $('<div class="hahsdk" style="display: none;"></div>');
                            hashsdkElement.text(allCopyMymarkdown); // 存储完整回答内容

                            buttonsContainer.append(regenerateBtn, copyBtn,hashsdkElement);
                            biandf.after(buttonsContainer);
                            // 添加按钮点击事件
                            regenerateBtn.click(function() {
                                layer.closeAll('tips');
                                // 获取对应的用户消息
                                const userMessage = biandf.prevAll('.user-message-box').find('.user-message').first();
                                if (userMessage.length) {
                                    const messageText = userMessage.text();

                                    // 清空历史记录
                                    $('#chat-messages').empty();

                                    // 滚动到顶部
                                    $('#chat-messages').animate({ scrollTop: 0 }, 300);

                                    // 延迟后发送请求
                                    setTimeout(() => {
                                        $('#user-input').val(messageText);
                                        updateSendButtonState();
                                        $('#send-button').click();
                                    }, 350);
                                }
                            });

                            copyBtn.click(function() {
                                // 获取当前按钮所在的 .message-buttons 容器
                                const buttonsContainer = $(this).closest('.message-buttons');
                                // 获取容器下的 .hahsdk 元素内容
                                const hahsdkElement  = buttonsContainer.find('.hahsdk')
                                if (hahsdkElement.length) {
                                    // 获取 .hahsdk 元素的 HTML 内容
                                    var htmlContent = hahsdkElement.text();
                                    console.log('htmlContent',htmlContent)
                                    // 查找 </think> 标签的位置
                                    var thinkEndIndex = htmlContent.indexOf('</think>');

                                    if (thinkEndIndex !== -1) {
                                        // 提取 </think> 标签后面的内容
                                        var contentAfterThink = htmlContent.substring(thinkEndIndex + 8); // +8 是为了跳过 </think>

                                        // 从提取的内容中创建一个临时元素，以便获取纯文本
                                        var tempDiv = $('<div>').html(contentAfterThink);
                                        var textToCopy = tempDiv.text().trim();

                                        // 过滤掉 undefined 字符串
                                        textToCopy = textToCopy.replace('undefined', '').trim();
                                        // 规范化空白字符：将多个连续空格、制表符和换行符替换为单个空格
                                        //textToCopy = textToCopy.replace(/[\s\n\r]+/g, ' ').trim();
                                        textToCopy = textToCopy.replace(/[ \t]+/g, ' ').replace(/\n{2,}/g, '\n').trim()
                                        if (textToCopy) {
                                            // 使用现代 Clipboard API
                                            navigator.clipboard.writeText(textToCopy)
                                                .then(function() {
                                                    layer.msg('复制成功！');
                                                    console.log('复制成功');
                                                })
                                                .catch(function(err) {
                                                    console.error('复制失败: ', err);

                                                });
                                        } else {
                                            console.log('没有可复制的内容');
                                        }
                                    } else {
                                        layer.msg('还没返回回答内容，不能复制');
                                    }
                                } else {
                                    console.log('未找到 .hahsdk 元素');
                                }


                            });
                            // 请求被手动取消
                            console.log('------请求被手动取消------',error.name)
                            return false
                        }
                        loadingMessage.remove();
                        // 出错时也隐藏加载动画
                        typingLoader.fadeOut(300, function() {
                            $(this).remove();
                            // 添加错误消息和按钮
                            const errorMessage = $('<div class="message ai-message">请求出错，请稍后重试。</div>');
                            aiMessage.after(errorMessage);
                            addButtonsToMessage(errorMessage);
                        });
                        currentRequest.isStreaming = false;
                        showButtons();
                        currentRequest.isActive = false;
                        resetRequestState();
                    });
            });

            // 添加重新生成和复制按钮到消息后面
            function addButtonsToMessage(messageElement) {
                const buttonsContainer = $('<div class="message-buttons"></div>');
                const regenerateBtn = $('<span class="regenerate-btn"></span>');
                const copyBtn = $('<span class="copy-btn"></span>');

                // 创建隐藏的hahsdk元素并添加到按钮容器
                const hashsdkElement = $('<div class="hahsdk" style="display: none;"></div>');
                hashsdkElement.text(allCopyMymarkdown); // 存储完整回答内容

                buttonsContainer.append(regenerateBtn, copyBtn,hashsdkElement);
                console.log('buttonsContainer',buttonsContainer)
                console.log('messageElement哈哈',messageElement)

                messageElement.after(buttonsContainer);

                // 添加按钮点击事件
                regenerateBtn.click(function() {
                    layer.closeAll('tips');
                    // 获取对应的用户消息
                    const userMessage = messageElement.prevAll('.user-message-box').find('.user-message').first();
                    if (userMessage.length) {
                        const messageText = userMessage.text();

                        // 清空历史记录
                        $('#chat-messages').empty();

                        // 滚动到顶部
                        $('#chat-messages').animate({ scrollTop: 0 }, 300);

                        // 延迟后发送请求
                        setTimeout(() => {
                            $('#user-input').val(messageText);
                            updateSendButtonState();
                            $('#send-button').click();
                        }, 350);
                    }
                });

                copyBtn.click(function() {
                    // 获取当前按钮所在的 .message-buttons 容器
                    const buttonsContainer = $(this).closest('.message-buttons');
                    // 获取容器下的 .hahsdk 元素内容
                    const hahsdkElement  = buttonsContainer.find('.hahsdk')
                    if (hahsdkElement.length) {
                        // 获取 .hahsdk 元素的 HTML 内容
                        var htmlContent = hahsdkElement.text();
                        console.log('htmlContent',htmlContent)
                        // 查找 </think> 标签的位置
                        var thinkEndIndex = htmlContent.indexOf('</think>');


                        if (thinkEndIndex !== -1) {
                            // 提取 </think> 标签后面的内容
                            var contentAfterThink = htmlContent.substring(thinkEndIndex + 8); // +8 是为了跳过 </think>

                            // 从提取的内容中创建一个临时元素，以便获取纯文本
                            var tempDiv = $('<div>').html(contentAfterThink);
                            var textToCopy = tempDiv.text().trim();

                            // 过滤掉 undefined 字符串
                            textToCopy = textToCopy.replace('undefined', '').trim();
                            // 规范化空白字符：将多个连续空格、制表符和换行符替换为单个空格
                            textToCopy = textToCopy.replace(/[ \t]+/g, ' ').replace(/\n{2,}/g, '\n').trim(); // 合并连续换行符为单个换行符（可选）.trim();

                            if (textToCopy) {
                                // 使用现代 Clipboard API
                                navigator.clipboard.writeText(textToCopy)
                                    .then(function() {
                                        console.log('复制成功');
                                    })
                                    .catch(function(err) {
                                        console.error('复制失败: ', err);

                                    });
                            } else {
                                console.log('没有可复制的内容');
                            }
                        } else {
                            layer.msg('还没返回回答内容，不能复制');
                        }
                    } else {
                        console.log('未找到 .hahsdk 元素');
                    }


                    // console.log('allCopy',allCopy)
                    // // 获取消息文本
                    // const messageText = messageElement.text();
                    // // 创建临时文本区域复制内容
                    // const tempTextArea = $('<textarea>');
                    // tempTextArea.val(messageText).appendTo('body').select();
                    // document.execCommand('copy');
                    // tempTextArea.remove();
                    //
                    // // 显示复制成功提示
                    // const originalText = copyBtn.text();
                    // layer.msg('复制成功！');
                    // //copyBtn.text('复制成功');
                    // setTimeout(() => {
                    //     copyBtn.text(originalText);
                    // }, 2000);
                });
            }

            function showButtons() {
                if (currentRequest.isStreaming) {
                    $('#send-button').hide();
                    $('#stop-button').show();
                } else {
                    $('#send-button').show();
                    $('#stop-button').hide();
                }
            }

            $('#user-input').keypress(function (e) {
                if (e.which === 13) {
                    e.preventDefault();
                    if ($('#send-button').hasClass('active')) {
                        $('#send-button').click();
                    }
                }
            });

            function updateSendButtonState() {
                const userInput = $('#user-input').val();
                $('#send-button').toggleClass('active', userInput.trim() !== '');
            }

            $('#stop-button').click(function () {
                // // 新增：立即消费剩余队列
                // if (typingQueue.length > 0) {
                //     displayedAnswer += typingQueue.join('');
                //     typingQueue = [];
                //     const html = mymarkdown.render(displayedAnswer);
                //     aiMessage.html(html);
                // }

                if (!currentRequest.isActive || !currentRequest.taskId) {
                    layer.msg('思考过程中不能停止！');
                    return;
                }

                const stopUrl = domainName+'/ai_service/df/chat/taskStop';
                const stopData = { token: token?token:getToken, taskId: currentRequest.taskId };

                currentRequest.isStreaming = false;
                // 隐藏加载动画
                $('.typing-loader').fadeOut(300, function() {
                    $(this).remove();
                });
                $.ajax({
                    url: stopUrl,
                    type: 'POST',
                    contentType: 'application/json',
                    data: JSON.stringify(stopData),
                    success: function (response) {
                        if(response.code==200){
                            controller.abort();
                            controller = new AbortController();//重新发起
                            // const stopMessage = $('<div style="color: #DC000C" class="message ai-message">你停止了本次回答</div>');
                            // $('#chat-messages').append(stopMessage);

                            $('#chat-messages').animate({ scrollTop: $('#chat-messages')[0].scrollHeight }, 0);
                        }
                        resetRequestState();
                        showButtons();
                    },
                    error: function (jqXHR, textStatus, errorThrown) {
                        controller.abort();
                        controller = new AbortController();//重新发起
                        console.error('停止任务请求失败:', textStatus, errorThrown);
                        const errorMessage = $('<div class="message ai-message">停止任务请求失败，请稍后重试。</div>');
                        $('#chat-messages').append(errorMessage);
                        $('#chat-messages').animate({ scrollTop: $('#chat-messages')[0].scrollHeight }, 0);
                        resetRequestState();
                        showButtons();
                    }
                });
            });

            $('#question-box').on('click', '.item', function() {
                const messageText = $(this).text();
                $('#user-input').val(messageText);
                updateSendButtonState();
                $('#send-button').click();
            });

            $('.mask').click(function () {
                $('.chat-modal').fadeOut();
                $(this).fadeOut();
            });

            $('.chat-modal').on('click', function (event) {
                event.stopPropagation();
            });
        });
    </script>

</div>